package com.softeem.controller;

import com.softeem.entity.User;
import com.softeem.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * @author Can丶
 * @create 2021-04-29 17:23
 *
 */

@Controller
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/Userlogin")
    public String login(User user, Map<String,Object> map) {
//        user.setUEmail("2047045726@qq.com");
//        user.setUPassword("fan123");
        User loginUser = userService.login(user);
        return "index";
    }//用户登录  成功返回user 不成功返回null；成功之后跳转页面（return给个页面）！！！！！！！！

    @RequestMapping("/UserRegister")
    @ResponseBody
    public Boolean register(User user) {
        return userService.register(user);
    }//用户注册  返回true或false   此方法只返回数据；

}
